/*
 *
 *
Copyright (c) 1998-2001 Aristar, Inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. The end-user documentation included with the redistribution, if any,
must include the following acknowledgment:

"This product includes software developed by Aristar, Inc. (http://www.aristar.com/)."

Alternately, this acknowledgment may appear in the software itself, if and
wherever such third-party acknowledgments normally appear.

4. The names "Dialect" and "Aristar, Inc." must not be used to endorse or
promote products derived from this software without prior written permission.
For written permission, please contact info@aristar.com.

5. Products derived from this software may not be called "Dialect", nor may
"Dialect" appear in their name, without prior written permission of Aristar, Inc.

THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
ARISTAR, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals
on behalf of Aristar, Inc.  For more information on Aristar, Inc.,
please see <http://www.aristar.com/>.

Portions of this software are based upon software freely available and
written by individuals not associated with Aristar, Inc.  Copyrights are
maintained in the relevant source code files.
 *
 *
 */

#ifndef __DIALECT_TCHAR_H
#define __DIALECT_TCHAR_H
///////////////////////////////////////////////////

#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>

#if defined(__WINCE__)
#	include <TCHAR.h>
#	define _toupper	towupper
#elif defined(__WINNT__)
#	include <TCHAR.h>
#	include <stdio.h>
#else

	#include <stddef.h>
	#include <stdio.h>

	typedef wchar_t*		LPWSTR;
	typedef const wchar_t*	LPCWSTR;
	typedef char*			LPSTR;
	typedef const char*		LPCSTR;

	///////////////////////////////////////////////////

	#ifdef UNICODE

	typedef wchar_t			TCHAR;
	typedef TCHAR*			LPTSTR;
	typedef const TCHAR*	LPCTSTR;

	#define _TEOF		WEOF

	#define _tprintf	wprintf
	#define _tscanf		wscanf
	#define _stprintf	wsprintf
	#define _vstprintf	vswprintf
	#define _vsntprintf	_vsnwprintf

	#define _tcscpy		wcscpy
	#define _tcslen		wcslen

	#define _istdigit	iswdigit
	#define _istalnum	iswalnum
	#define _ttoi		_wtoi
	//#define _toupper	towupper
	#define _tstrdate	_wstrdate

	#define _tremove	_wremove
	#define _trename	_wrename

	#else // !UNICODE /////////////////////////////////

	typedef char			TCHAR;
	typedef TCHAR*			LPTSTR;
	typedef const TCHAR*	LPCTSTR;
	#define _T(x)			x

	#define _TEOF EOF

	#define _tprintf	printf
	#define _tscanf		scanf
	#define _stprintf	sprintf
	#define _vstprintf	vsprintf
	#define _vsntprintf	vsnprintf

	#define _tcscpy		strcpy
	#define _tcsncpy	strncpy
	#define _tcslen		strlen
	#define _tcscmp		strcmp
	#define _tcsicmp	strcasecmp
	#define _tcscat		strcat
	#define _tcsstr		strstr
	#define _tcsupr		_strupr
	#define _tcslwr		_strlwr
	#define _tcsrchr	strrchr

	#define _istdigit	isdigit
	#define _istalnum	isalnum
	#define _ttoi		atoi
	//#define _toupper	toupper
	#define _tstrdate	_strdate

	#define _tremove	remove
	#define _trename	rename
	#define _tmkdir		mkdir

	#endif // UNICODE
	///////////////////////////////////////////////////

#endif // __WINNT__ || __WINCE__

///////////////////////////////////////////////////
#endif // __DIALECT_TCHAR_H
